#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    //gl::log(this->objectName());
}

Widget::~Widget()
{
    delete ui;
}

float Widget::normalSliderValue(QSlider * sl){
    return static_cast<float>(sl->value()  - sl->minimum()) /
            static_cast<float>(sl->maximum() - sl->minimum());

}

void Widget::on_sldVolume1_valueChanged(int val){
    Q_UNUSED(val)
    emit volume(1, normalSliderValue(ui->sldVolume1));
}

void Widget::on_sldVolume2_valueChanged(int val){
    Q_UNUSED(val)
    emit volume(2, normalSliderValue(ui->sldVolume2));
}

void Widget::on_sldVolume3_valueChanged(int val){
    Q_UNUSED(val)
    emit volume(3, normalSliderValue(ui->sldVolume3));
}

void Widget::on_sldVolumeAll_valueChanged(int val){
    Q_UNUSED(val)
    emit volume(0, normalSliderValue(ui->sldVolumeAll));
}
